

<?
//display section in functie de id (daca acesta este 0 atunci se adauga):
function display($id)
{
	if ($id==0)
	{
	?>
	<form  action="human_res.php" method="post" enctype="multipart/form-data">
<!--	<form action="" name="testQR" method="post" enctype="multipart/form-data"> -->
	<table style="width:95%">
	<tr><td width="100px">Surname</td><td><input name="pname" type="text" value="" style="width:200px"></td></tr>
	<tr><td>Name</td><td><input name="surname" type="text" value="" style="width:200px"></td></tr>
    <tr><td> Pick company </td> <td>
	<select name="id_company" onchange="" style="width:220px;">
		<?php
			echo "<option>-- Select Item --</option>\n";
			$instructiune="SELECT name FROM companies where account=".$_SESSION["account"].";";
			$interogare=mysql_query($instructiune);
			while($rand=mysql_fetch_array($interogare))
				{
					if($_GET["id_company"]==$rand['name']) $selected="selected";
						else $selected="";
					echo("\t   <option {".$selected."} value='".$rand['name']."'> ".$rand['name']." </option>  \n");
					
				}
		?>
	</select>
	<!-- </form> -->
	</td></tr>
<td> 
	<tr><td>Position</td><td><input name="position" type="text" value="" style="width:200px"></td></tr>
	<tr><td>Address</td><td><input name="address" type="text" value="" style="width:200px"></td></tr>
	<tr><td>Mobile phone</td><td><input name="mobile_ph" type="text" value="" style="width:200px"></td></tr>
	<tr><td>Company phone</td><td><input name="company_ph" type="text" value="" style="width:200px"></td></tr>
    <tr><td>Experience</td><td><input  type="text" name="experience" value="" style="width:200px"></td></tr>
    <tr><td>CV</td><td><input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="cv" type="file" id="cv" value="" style="width:200px"></td></tr>
    <tr><td>Work schedule</td><td><input name="work_schedule" type="text" value="" style="width:200px"></td></tr>
    
  
    <tr><td><input type="submit" name="qr_add" value="Add" ></td>
	<td align="right">
	<input type="submit" name="qr_cancel" value="Cancel" >
	</td></tr>
	</table>
	</form>
	<?
	}
	else
	{
	//poate reusim sa facem transfer de variabile ca sa nu stresam db'ul...
	$result = returnQuery("select * from human_resources where id = ".$id.";",'');
	$row = mysql_fetch_assoc($result);
	?>
	<form action="" name="testQR" method="post" enctype="multipart/form-data">
	<table width="95%">
	<? $result2 = returnQuery("select * from companies where id = ".$row['id_company'].";",''); 
	$row2 = mysql_fetch_assoc($result2);?>
    
	<tr><td width="100px">Surname</td><td><input name="pname" type="text" value="<? echo $row['name'] ?>" style="width:200px"></td></tr>
	<tr><td>Name</td><td><input name="surname" type="text" value="<? echo $row['surname'] ?>" style="width:200px"></td></tr>
	<tr><td>Company</td><td><input name="id_company" type="text" value="<? echo $row2['name'] ?>" style="width:200px"></td></tr>
	<tr><td>Position</td><td><input name="position" type="text" value="<? echo $row['position'] ?>" style="width:200px"></td></tr>
	<tr><td>Address</td><td><input name="address" type="text" value="<? echo $row['address'] ?>" style="width:200px"></td></tr>
	<tr><td>Mobile phone</td><td><input name="mobile_ph" type="text" value="<? echo $row['mobile_ph'] ?>" style="width:200px"></td></tr>
	<tr><td>Company phone</td><td><input name="company_ph" type="text" value="<? echo $row['company_ph'] ?>" style="width:200px"></td></tr>
    <tr><td>Experience</td><td><input name="experience" value="<? echo $row['experience'] ?>" style="width:200px"></td></tr>
    <tr><td>CV</td><td><input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="cv" type="file" id="cv" value="<? echo $row['cv'] ?>" style="width:200px"></td></tr>
    <tr><td>Work schedule</td><td><input name="work_schedule" type="text" value="<? echo $row['work_schedule'] ?>" style="width:200px"></td></tr>
    
	<tr><td><input type="submit" name="qr_update" value="Update">
	<input type="submit" name="qr_del" value="Delete"></td>
	<td align="right"><input type="submit" name="qr_cancel" value="Cancel"></td></tr>
	</table>
	</form>
	<?
	}
}

	

?>